/**
 * @date 2006-7-18
 */

package org.nanhill.xmlro.gsp;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.nanhill.xmlro.gsp.client.DefaultGspAgent;
import org.nanhill.xmlro.gsp.client.GspAgent;

/**
 * @author alin [xalinx at gmail dot com]
 * @date 2006-7-18
 */
public class ShowInheritSample {

	/**
	 * @param args
	 * @throws GspException
	 */
	public static void main(String[] args) {
		Map<String, Object> request = new HashMap<String, Object>();
		request.put("message#", 46810L);
		request.put("inheritid", 1L);
		GspAgent searchAgent = new DefaultGspAgent("hawaii.kernel.sls");
		try {
			searchAgent.addSLSTarget("192.168.3.6", 2001);
			searchAgent.setServiceType("centaurus.uiservice", "1");
			searchAgent.locate();
			Map result = (Map) searchAgent.doService("showinherit", request);
			List child = (List) result.get("child");
			if (null != child)
				for (Object item : child) {
					Map msg = (Map) item;
					String name = (String) msg.get("message#");
					System.out.println(name);
				}
			// ----------- close ------------
			searchAgent.close();
		} catch (GspException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
}
